﻿@model Financas.Models.BuscaMovimentacoesModel

@using (Html.BeginForm("Busca", "Movimentacao", FormMethod.Get))
{
    <div class="row">
        <fieldset>
            <legend>Data movimentacao</legend>
            <div class="col-sm-6">
                @Html.LabelFor(b => b.DataMinima, "Minima")
                @Html.TextBoxFor(b => b.DataMinima, new {@class="form-control" })
            </div>
            <div class="col-sm-6">
                @Html.LabelFor(b => b.DataMaxima, "Maxima")
                @Html.TextBoxFor(b => b.DataMaxima, new { @class = "form-control" })
            </div>
        </fieldset>
        <fieldset>
            <legend>Valor da movimentação</legend>
            <div class="col-sm-6">
                @Html.LabelFor(b => b.ValorMinimo, "Minima")
                @Html.TextBoxFor(b => b.ValorMinimo, new { @class = "form-control" })
            </div>
            <div class="col-sm-6">
                @Html.LabelFor(b => b.ValorMaximo, "Maxima")
                @Html.TextBoxFor(b => b.ValorMaximo, new { @class = "form-control" })
            </div>
        </fieldset>
        <fieldset>
            <legend>Usuario e Tipo</legend>
            <div class="col-sm-6">
                @Html.LabelFor(b => b.Tipo, "Tipo")
                @Html.EnumDropDownListFor(b => b.Tipo, new {@class = "form-control" })
            </div>
            <div class="col-sm-6">
                @Html.LabelFor(b => b.UsuarioID, "Usuario")
                @Html.DropDownListFor(b => b.UsuarioID,
                   new SelectList(Model.Usuarios, "Id", "Nome"),
                   "Escolha um usuario")
            </div>
        </fieldset> 
        <input type="submit" value="Buscar"/>
    </div>
}

<table class="table table-hover">
    <thead>
        <tr>
            <th>Id</th>
            <th>Data</th>
            <th>Valor</th>
            <th>Tipo</th>
            <th>Usuario</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var m in Model.Movimentacoes)
        {
            <tr>
                <td>@m.ID</td>
                <td>@m.Data</td>
                <td>@m.Valor</td>
                <td>@m.Tipo</td>
                <td>@m.Usuario.Nome</td>

            </tr>
        }
    </tbody>
</table>
